<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>书架</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script>
    <script src='js/jquery.js'></script>
    <script src='js/bootstrap.min.js'></script>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        ul {
            list-style: none;
        }

        .head_title {
            width: 60px;
            height: 60px;
        }

        .dropdown {
            float: right;
        }

        nav {
            margin-bottom: 0px;
            background: #ccc;
            font-size: 2em;
        }

        .remindTitle {
            color: #f00;
        }
        #navli :hover{
            color: #f00;
        }
        #navPhoto{
            width: 60px;
            height: 60%;
        }
        #recomendBookData{
            width: 400px;
            height: 350px;
            float:left;
            border:1px solid #ccc;
            padding:10px;
            margin:10px;
        }
        img{
            width: 150px;
            height: 150px;
        }
        h3{
            text-align: center;
            color: #00f;
        }
    </style>
    <script>
        window.onload = function () {
            var vm1 = new Vue({
                el: '.navbar',
                data: {
                    
                },
                methods: {
                    exit(){
                        window.location.href="HomePage.html"
                    }
                }
            })

            var vm2 = new Vue({
                el:'#recomendBook',
                data:{
                    recomendBook:[]
                },
                methods:{
                    show(){
                        this.recomendBook = [{},{}]
                    }
                },
                //当Vue实例挂载结束后，加载远程数据设置Data属性
                mounted(){
                     $.getJSON('recomemendBook.json',result => {
                        this.recomendBook = result.recommendbook
                   })
                },
            })
        }

    </script>
</head>
<body>
    <!-- 1.顶部导航栏 -->
    <nav class="navbar">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar"
                    aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <img src="images/bookTitle.png" alt="" class="head_title">
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="myNavbar">
                <ul class="nav navbar-nav">
                    <li id="navli" class="active"><a href="#">个人书架 <span class="sr-only">(current)</span></a></li>
                    <li id="navli"><a href="HomePage.html">书海首页</a></li>
                    <li id="navli"><a href="mainPage.html">书海主页</a></li>
                </ul>
                <!-- 右侧输出 -->
                <ul class="nav navbar-nav navbar-right hidden-sm">
                    <li>
                        <img src="images/timg.jpg" alt="" class="head_title">
                    </li>
                    <li id="navli"><a href="#" >欢迎</a></li>
                    <!-- 模态框实现退出操作 -->
                    <li id="navli">
                        <input type="button"
                    data-toggle="modal" data-target="#myModal" class="btn btn-danger"
                     value='退出'>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">友情提示</h4>
                    </div>
                    <div class="modal-body">
                        您是否确认退出？
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary"  @click="exit"
                        data-dismiss="modal">确认</button>
                    </div>
                </div>
            </div>
        </div>
    </nav>
    <h3>推荐书籍</h3>
    <div id="recomendBook">
        <!-- <table>
            <tr>
                <th>书面</th>
                <th>编号</th>
                <th>书名</th>
                <th>作者</th>
                <th>分类</th>
            </tr>
               <tr  id="recomendBookData" v-for="(recommendbook,index) in recomendBook">
                   <td class="col-xs-5"><img :src="recommendbook.image" alt=""></td>
                   <td class="col-xs-1"><span>{{index+1}}</span></td>
                   <td class="col-xs-2"><p>{{recommendbook.name}}</p></td>
                   <td class="col-xs-2"><p>{{recommendbook.author}}</p></td>
                   <td class="col-xs-2"><p>{{recommendbook.classBook}}</p></td>
               </tr>
        </table> -->
        <ul>
            <li  id="recomendBookData" v-for="(recommendbook,index) in recomendBook">
                <img :src="recommendbook.image" alt="">
                <p>名称：{{recommendbook.name}}</p>
                <p>作者：{{recommendbook.author}}</p>
                <p>分类：{{recommendbook.classBook}}</p>
                <p>简介：{{recommendbook.way}}</p>
            </li>
        </ul>
        <h3>我的书架</h3>
        
    </div>
</body>
</html>